<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateKdDesignerDemandsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('kd_designer_demands', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->comment('创建者');
            $table->string('title')->comment('标题');
            $table->string('onum')->nullable()->comment('单号');
            $table->string('crm_oid')->nullable()->comment('客户订单记录ID');
            $table->integer('k_crm_project_id')->nullable()->comment('专卖店需求ID');
            $table->integer('designer_id')->nullable()->comment('中标设计师ID');
            $table->timestamp('designer_bidding_at')->nullable()->comment('中标设计师中标时间');
            $table->tinyInteger('is_appoint')->default(-1)->comment('1指定设计师,-1不指定设计师');
            $table->decimal('max_charge', 9, 2)->default(0)->comment('最高价格');
            $table->timestamp('plan_finish_at')->nullable()->comment('计划完成时间');
            $table->text('detailed_desc')->nullable()->comment('详细介绍');
            $table->string('attachment')->default('')->comment('需求附件');
            $table->string('remark')->default('')->comment('备注');
            $table->timestamp('first_finish_at')->nullable()->comment('第一次上传方案时间');
            $table->timestamp('last_finish_at')->nullable()->comment('最后一次上传方案时间');
            $table->timestamp('verify_at')->nullable()->comment('审核确定方案时间');
            $table->string('programme_attachment')->nullable()->comment('中标设计师方案附件');
            $table->tinyInteger('status')->default(1)->comment('1寻找中,2设计中,3已完工');
            $table->tinyInteger('detail_status')->default(1)->comment('1寻找中-未有人投标,2寻找中-已有人投标,3设计中-未上传方案,4设计中-已上传方案,5已完工-已审核方案');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('kd_designer_demands');
    }
}
